Get required client roles via script

I'm creating a "fake" login screen, because I need to control the login attempts and block users if they exceed the attempts, and I need to get the required client roles of the project via script to compare with the user roles. Is there any way to do that?

I'm building a template and I have more than 50 projects to implement, it would be much easier to get this info by the project instead of configuring all of them again manually

REQUIRED_ROLES= ['Role1', 'Role2',] #etc
USER_SOURCE = 'someUserSource'

def login(username, password):
    user = system.user.getUser(USER_SOURCE, username)
    roles = user.getRoles()
    if not any([r in REQUIRED_ROLES for r roles]):
        # Bail early here, user does not have any of the roles you required

Something like this? This works in a "at least 1 role matches" which is what I assume you want just for a login and since you're rolling your own login logic on top of it anways.

Also you should talk to someone about upgrading from 7.9. Any bugs you run into now your only help will basically be this forum. Espeically if they're already going through the trouble of upgrading 50 projects.

That is a binary resource prior to v8.3. Sorry.

Yes, but I wanted to get the required roles that are already configured in my project, instead of hardcode it, as I need to implement it to all my projects. But thanks, mate!

Oh I see you're problem now. Yea think you're out of luck. Sorry!

Hmmm ok, understood. So, while we don't upgrade our version, I will create a custom property and pass the roles as a parameter in my template, I think I'll have no other option. Thank you!

A Vision Client tag might be another option where it's set to read-only