cancel
Showing results for 
Search instead for 
Did you mean: 

Check if user is admin

monitloth
Champ on-the-rise
Champ on-the-rise
Hello,

I want to check if the user is admin. I know that there is a function isAdmin in the javascript framework, but I couldn't find the same function nor an alternative in Alfresco.

I can get the name of the user with  Repository.getServiceRegistry(fc).getAuthenticationService().getCurrentUserName().

Thanks.
3 REPLIES 3

monitloth
Champ on-the-rise
Champ on-the-rise
Ok, I got it, thanks to the CreateWebProjectEvaluator sources.

It follows:

FacesContext fc = FacesContext.getCurrentInstance();
ServiceRegistry services = Repository.getServiceRegistry(fc);
NavigationBean navigator = (NavigationBean)FacesHelper.getManagedBean(fc, NavigationBean.BEAN_NAME);

navigator.getCurrentUser().isAdmin();

monitloth
Champ on-the-rise
Champ on-the-rise
Now what I want is to get the parentfolder of the folder I am on. I searched the forums and documentation.

How can I do this?

Thanks very much.

guilherme_souza
Champ in-the-making
Champ in-the-making
In Javascript, this method returns the name of the document parent.

var parentName = document.parent.name;