Hi there when I user method session.authenticateSessionUser like the way dialog login administrator used , I just authentication all user in this Application , can't found admin user of all Application the sample : when I setup Ivy server I create a user admin to login administrator (admin/admin) , but when I call session.authenticateSessionUser at my application in server I can't found admin user do we have a way to authenticate that user ? thanks a lot

asked 15.01.2014 at 08:54

toantp's gravatar image

toantp
1555
accept rate: 0%

edited 22.01.2014 at 12:09

admin's gravatar image

admin ♦♦
11125

Can you explain me the use case you want to solve by authenticate a system administrator in your application? I may can help you better if I know the root cause of your question.

(16.01.2014 at 09:07) Reto Weiss ♦♦ Reto%20Weiss's gravatar image

I want to create a application,so I can login with system administration account I used session.authenticateSessionUser(username ,pass) but can't found system administrator user

(16.01.2014 at 11:18) toantp toantp's gravatar image

You can make any user of an application a system administrator by granting him all permissions of the system security descriptor type on the system security descriptor.

See SystemAdminMaker.java file below for more details.

Note the class uses NON Public API and will therefore break in future releases of Xpert.ivy!

SystemAdminMaker.java:

package ch.ivyteam.ivy.demo;

import ch.ivyteam.ivy.security.IPermissionGroup;
import ch.ivyteam.ivy.security.ISecurityDescriptor;
import ch.ivyteam.ivy.security.ISecurityManager;
import ch.ivyteam.ivy.security.IUser;
import ch.ivyteam.ivy.server.IServer;
import ch.ivyteam.ivy.server.ServerFactory;

// ============================================================
// ATTENTION:
// ============================================================
// The following code access NON PUBLIC API. 
// Therefore this code will break in future Xpert.ivy versions!
// ============================================================
public class SystemAdminMaker 
{
    public void grantSystemAdminRightsTo(IUser user)
    {
        ISecurityDescriptor systemSecurityDescriptor = getSystemSecurityDescriptor();       
        systemSecurityDescriptor.grantPermissions(getRootPermissionGroup(), user);
    }

    public void ungrantSystemAdminRightsTo(IUser user)
    {
        ISecurityDescriptor systemSecurityDescriptor = getSystemSecurityDescriptor();       
        systemSecurityDescriptor.ungrantPermissions(getRootPermissionGroup(), user);
    }

    private ISecurityDescriptor getSystemSecurityDescriptor() 
    {
        IServer server = ServerFactory.getServer();
        ISecurityManager securityManager = server.getSecurityManager();
        ISecurityDescriptor systemSecurityDescriptor = securityManager.getSystemSecurityDescriptor();
        return systemSecurityDescriptor;
    }

    private IPermissionGroup getRootPermissionGroup()
    {
        return getSystemSecurityDescriptor().getSecurityDescriptorType().getRootPermissionGroup();
    }
}
link

answered 17.01.2014 at 16:28

Reto%20Weiss's gravatar image

Reto Weiss ♦♦
4.2k172450
accept rate: 73%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×23
×14
×12

Asked: 15.01.2014 at 08:54

Seen: 1,713 times

Last updated: 22.01.2014 at 12:09