Skip to Content (Press Enter)
OutSystems.com
Personal Edition
Community
Support
Training
Training
Online Training
Developer Schools
Boot Camps
Certifications
Tech Talks
Documentation
Documentation
Overview
ODC
O11
Forums
Forge
Get Involved
Get Involved
Jobs
Ideas
Members
Mentorship
User Groups
Platform
Platform
ODC
O11
Search in OutSystems
Log in
Get Started
Back to Forums
André Siébra
128
Views
15
Comments
Solved
How to retrive the roles from the page?
Question
Roles
I need
to retrieve the
roles
that have been set
for a page.
These
roles
are defined
in
development
on the page itself
(by selecting
the
roles
checkboxes
in the properties
of the page)
when
we want to
restrict
users' access to
it.
I suppose
this information is
in the
metadata
,
but do not know
where exactly
...
any ideas
?
Thanks,
André Siébra
Solution
Good point J., yes indeed, this should not change.
Overall, retrieve page roles is a better approach to implement handcoded. It's easier, more scalable and easier to maintain (a module with many pages for example, give more work).
But you're right, unafortunately sometimes it's hard to convince a client about things like that.. but worth a try!
Thank you :)
See solution in context
João Carvalho
Hi André,
Did you find any solution for that problem?
J.
MVP
i'm clueless why you want to figure it out the other way around?
you know what the roles are, so you either grant them or not upfront or when user is logging in?
2 replies
Last reply 25 Aug 2015
Show thread
Hide thread
João Carvalho
J.
wrote:
i'm clueless why you want to figure it out the other way around?
you know what the roles are, so you either grant them or not upfront or when user is logging in?
Hi J.,
I need to have a combobox where users can choose a page. Obviously, i just want to show in that combobox, pages that the user has access.
André Siébra
J.
wrote:
i'm clueless why you want to figure it out the other way around?
you know what the roles are, so you either grant them or not upfront or when user is logging in?J.
@J.,
In my case, I need to peform some actions based on the permissions set for a page. It's a rather complex scenario, but basically I have an action that retrieves a profile based on a list of roles (the roles set for a page) passed as input parameter. I wish to get these roles automatically from the page, so I can pass it to my action.
To workaround this, I had to made all hardcoded.. but it's not scale and is dificult to maintain.
João Pedro Abreu
Staff
I'm fairly certain the metadata needed to do this is not available. It is only stored in the OML file itself, which you can't access.
1 reply
25 Aug 2015
Show thread
Hide thread
André Siébra
João Pedro Abreu
wrote:
I'm fairly certain the metadata needed to do this is not available. It is only stored in the OML file itself, which you can't access.
@João Pedro, thanks for the tip. Actually it's possible to access the OML file of an espace. There is a
GetDocumentation
action from an extension called
EspaceMetaModel
that receive the OML file binary as input parameter and returns the XML output file. You can find this extension in the
OutDoc
Forge component.
I hoped there was an easier way... but its ok, let's try this :)
João Heleno
MVP
@André
Have you tried peeking the runtimeplatform dll/jar files? The APIs are not documented but I've seen people use them before... you can easily get some stuff like Screen Context (names, keys, etc).
I'm sure you'll find something like GetScreenRoles(arg0)... you just have to be patient and try a lot ;)
Edit: In Java there is a getPageRules() function in the HeContext class... maybe it's this... I would have to test it.
1 reply
26 Aug 2015
Show thread
Hide thread
André Siébra
Joao Heleno
wrote:
@André
Have you tried peeking the runtimeplatform dll/jar files? The APIs are not documented but I've seen people use them before... you can easily get some stuff like Screen Context (names, keys, etc).
I'm sure you'll find something like GetScreenRoles(arg0)... you just have to be patient and try a lot ;)
Edit: In Java there is a getPageRules() function in the HeContext class... maybe it's this... I would have to test it.
So many Joãos on this post, a new record haha
@João Heleno, I've never worked with the runtimeplatform dll/jar files before. It seems very interesting, I'll check this out. Thanks man! :)
Kilian Hekhuis
MVP
What I'm not getting: since there's no way to retrieve information about individual screens from the meta data, where's the list of screens coming from? If that's handcoded, why not handcode the needed permissions as well?
1 reply
28 Aug 2015
Show thread
Hide thread
André Siébra
Kilian Hekhuis
wrote:
What I'm not getting: since there's no way to retrieve information about individual screens from the meta data, where's the list of screens coming from? If that's handcoded, why not handcode the needed permissions as well?
Good question. I guess you can retrieve information about screens from the metadata, but the roles set to them... well I could not find it. But that information must be somewhere. So I had to do all handcoded like you said, by creating an action that retrieves the permissions of the page (passed as input parameter). But if the permissions changes for a page, I'll have to change this action too to reflect these changes...
Kilian Hekhuis
MVP
Yeah, it isn't ideal, that's for sure.
J.
MVP
On that note and rereading your usecase..
You are saying you want to determine your profile...
But isn't your profile just a "group" of roles, and thus you can fish it out by querying Group, Group_Role and Group_user?
1 reply
28 Aug 2015
Show thread
Hide thread
André Siébra
J.
wrote:
On that note and rereading your usecase..
You are saying you want to determine your profile...
But isn't your profile just a "group" of roles, and thus you can fish it out by querying Group, Group_Role and Group_user?
humm very interesting J., it seems a good workaround too. I can create a group for each page in my module with its respective roles set. So when User log in, I just need to check if he allows to that group that refers to the page. Anyway... the bad news is that this way I still have to maintain the groups if the page permissions change =/
J.
MVP
Erm,
do you really expect the permissions of a page are changing that often?
Those permissions should not change at all, except for some new features.
But you either end up with a new page or a new role...
Tbh, I never understood the need for "dynamic" roles. It's a fun experiment, but in production it actually never changes...
André Siébra
Solution
Good point J., yes indeed, this should not change.
Overall, retrieve page roles is a better approach to implement handcoded. It's easier, more scalable and easier to maintain (a module with many pages for example, give more work).
But you're right, unafortunately sometimes it's hard to convince a client about things like that.. but worth a try!
Thank you :)
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
See the full guidelines
Loading...