'Get the user\'s default permissions for the new histories'

@expose_api
def get_permissions(self, trans, id, payload={}, **kwd):

    user = self._get_user(trans, id)
    roles = user.all_roles()
    permitted_actions = trans.app.model.Dataset.permitted_actions.items()
    inputs = []
    for (index, action) in permitted_actions:
        inputs.append({'type': 'select', 'multiple': True, 'optional': True, 'name': index, 'label': action.action, 'help': action.description, 'options': [(r.name, r.id) for r in roles], 'value': [a.role.id for a in user.default_permissions if (a.action == action.action)]})
    return {'message': 'Permissions    unchanged.', 'inputs': inputs}
