I am new to ITIM. I am working on an application in JAVA. I want to authorize users based on groups they are assigned to. How can I do that?
Is there any api that can fetch user roles/groups by which I can authorize them?
The system user will have an attribute of ‘erroles’ through which we can get information of user groups/Roles.
Get DistinguishedName from Person object. Make PersonMO object having constructor like new PersonMO(platform, subject, person.getDistinguishedName());
Make new AccountManager(platform, subject);
This will give accounts collection accountManager.getAccounts(personMO, LocaleCreator.getLocale());
Get getSystemUserDN(userId);. PersonDao class will help in getting this.
Make new SystemUserMO(m_platform, m_subject, new DistinguishedName(systemUserDN));
Get the roles/Groups from systemUserMO.getData().getRoles()
Cheers Imran Tariq
Related
I've got the following Problem:
I am trying to implement one Discord Slash-Command with the JDA that can be entered like this:
/user #User
or like this:
/user 277048745458401282
But you should be required to use one of the Options.
I currently have a /user Slash-Command with a USER OptionType, but my Question would be how I could add another Option to it, but you have to only choose one of the 2 Options.
This is my current code:
List<CommandData> cmds = new ArrayList<CommandData>();
cmds.add(new CommandData("user", "Shows information about a specific Discord User.")
.addOption(OptionType.USER, "user", "The user you want to get the information from."));
jda.getGuildById(712313516542918717L).updateCommands().addCommands(cmds).queue();
Thanks to Minn for answering in the Comments.
The OptionType user accepts user ids too. You can just paste the id in the client.
This worked for me :D
I need to know how to take info from the user in one page using a label and textfield and displaying that in a grid in another page.
For example, Im getting the name of the user and displaying their name in following page in a grid. I'm using eclipse and working with vaadin, if that helps.
if what you need is an info from connected user, I suggest you to set the User object as Session Attribute.
IE:
User connectedUser = new User();
VaadinSession.getCurrent().setAttribute(User.class, connectedUser);
Then, if you need to pick this information, you just have to call
User currentUser = (User) VaadinSession.getCurrent().getAttribute(User.class);
Then, you can pick with all your getter all the required infos, like
String username = currentUser.getUsername();
In my opinion the best approach is to set the user attribute after his login, so you can have it everywhere you need to pick it from any class of your Vaadin application.
Hope this helps.
Bye
My code is :
List<Status> list = new ArrayList<Status>();
User user;
Twitter twitter = new Twitter();
list = twitter.search(string);
for(int i=0; i<list.size();i++){
user=list.get(i).getUser();
System.out.print(i+1);
System.out.println(list.get(i));
System.out.println(list.get(i).getId());
System.out.println(list.get(i).getUser());
System.out.println(user.getId());
System.out.println(user.getCreatedAt());
System.out.println(user.getLocation());
System.out.println(user.getFavoritesCount());
}
The problem is that good print the status, id of status and user, but user features how user id, location, etc, prints all as null. What I can do to take the features????
Thanks for response
According to the JTwitter API Docs, calling the default constructor creates a new instance without a user. You need to authenticate with Twitter using Twitter.IHttpClient (which depends on Signpost) to get user data.
The Twitter search method is unusual in that it only returns a small part of the User information. This is a limitation from Twitter & there's nothing you can do about that.
Fields such as location will be blank.
You always get the screen-name, and this can be used to fetch the extra info via the show() method. E.g.
Twitter twitter;
List<String> userNames; // make this list from user.screenName
List<User> fullUserInfo = twitter.users().show(userNames)
If you have an up-to-date copy of JTwitter (http://www.winterwell.com/software/jtwitter.php) it is all in the javadoc.
NB: Other methods sometimes return missing fields in User, if Twitter is experiencing heavy load.
I am working in JAVA application and authenticating user through ITIM api. How to get groups accociated with user through ITIM api?
The system user will have an attribute of ‘erroles’ through which we can get information of user groups/Roles.
Get DistinguishedName from Person object.
Make PersonMO object having constructor like new PersonMO(platform, subject, person.getDistinguishedName());
Make new AccountManager(platform, subject);
This will give accounts collection accountManager.getAccounts(personMO, LocaleCreator.getLocale());
Get getSystemUserDN(userId);. PersonDao class will help in getting this.
Make new SystemUserMO(m_platform, m_subject, new DistinguishedName(systemUserDN));
Get the roles/Groups from systemUserMO.getData().getRoles()
Cheers
Imran Tariq
I'm developing one web application project using java for education industry.In this Admin have all rights to access the google services of other users like A,B,C..... for this is use OAuth.Then i tried Admin want to share user A's calendar to user B using OAuth.But i got stuck in this step. Is it possible Plz Help me
Thanks
Regards
Sharun
I believe you want to use Access Control Lists (ACLs), see the docs. The Java example code at this URL for the task you mention is pretty simple:
AclEntry entry = new AclEntry();
entry.setScope(new AclScope(AclScope.Type.USER, "jdoe#gmail.com"));
entry.setRole(CalendarAclRole.READ);
URL aclUrl =
new URL("http://www.google.com/calendar/feeds/jo#gmail.com/acl/full");
AclEntry insertedEntry = service.insert(aclUrl, entry);
and what it does is, and I quote:
This code allows jdoe#gmail.com to
have read-only access to
jo#gmail.com's calendar.
There's more where this came from (e.g., upgrading a user's role in an ACL above the read-only access granted in this example), and I think it's a good idea to read the whole page.