ios - Filtering AWS-Cognito users by role -
i've been looking day how avail.
let's have 2 users in user pool, john admin , jim user. have view controller want accessible john admin not jim user. problem don't know how distinguish john , jim in app.
is there way know john admin in admin groups/role jim not?
edit: asking user attributes gave me:
{"userattributes": [ { "name": "sub", "value": "numbers"}, { "name": "email_verified", "value": "true"}, { "name": "phone_number_verified", "value": "false"}, { "name": "phone_number", "value": "numbers"}, { "name": "email", "value": "email"}], "username": "johnadmin"}
your user model should contain property allow distinguish users roles. e.g
struct user { var name = "" var role = "user" // can use enum here or else want }
after user got logged in should set property proper value. further before presenting view controller should check property , decide show or not show view controller
Comments
Post a Comment