Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create backend logic to create new roles #3211

Open
jeff1evesque opened this issue Mar 27, 2018 · 0 comments
Open

Create backend logic to create new roles #3211

jeff1evesque opened this issue Mar 27, 2018 · 0 comments

Comments

@jeff1evesque
Copy link
Owner

jeff1evesque commented Mar 27, 2018

Based on our #3208, we need to adjust necessary back python logic, to incorporate the following:

New Role: create a new role type, owned by current user.

INSERT INTO RoleType (RoleType) VALUES (‘new-role’);
INSERT INTO Role (RoleOwner, RoleTypeID, UserID)
SELECT1’, RoleType.RoleTypeID, Account.UserID
FROM Account
OUTER JOIN RoleType ON RoleType.RoleType = ‘new-role’
WHERE Account.Username = ‘current-user’

The above implementation will likely occur in the applications backend code.

query = '''\

        INSERT INTO RoleType (RoleType) VALUES (%s);

        '''
args = (role_type)
cur.execute(query, args)


query = '''\

        INSERT INTO Role (RoleOwner, RoleTypeID, UserID)
        SELECT %s, RoleType.RoleTypeID, Account.UserID
        FROM Account
        OUTER JOIN RoleType ON RoleType.RoleType = %s
        WHERE Account.Username = %s

        '''
args = (role_owner, role_type, username)
cur.execute(query, args)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant