18 package org.turro.elephant.impl.security;
20 import java.io.IOException;
21 import java.util.List;
22 import java.util.logging.Level;
23 import java.util.logging.Logger;
24 import org.jdom.Element;
25 import org.jdom.JDOMException;
26 import org.jdom.xpath.XPath;
27 import org.turro.elephant.context.ElephantContext;
28 import org.turro.plugin.contacts.IContact;
29 import org.turro.plugin.contacts.IProfile;
44 List<Element> roles = XPath.selectNodes(user,
"role");
45 for(Element el : roles) {
48 }
catch (JDOMException ex) {
57 if(contact.isValid()) {
58 for(String role : contact.getRoles()) {
60 upm.put(
"#" + role,
new RoleValue(
new String[] {
"on" }));
62 for(String syndication : contact.getSyndications()) {
63 upm.put(
"@" + syndication,
new RoleValue(
new String[] {
"on" }));
65 if(contact.isUser()) {
66 IProfile profile = contact.getProfile();
67 if(contact.isAdmin()) {
68 upm.put(
"@admin",
new RoleValue(
new String[] {
"is" }));
71 upm.put(
"@worker",
new RoleValue(
new String[] {
"is" }));
74 upm.put(
"@student",
new RoleValue(
new String[] {
"is" }));
77 upm.put(
"@responsible",
new RoleValue(
new String[] {
"is" }));
80 upm.put(
"@hhrr",
new RoleValue(
new String[] {
"is" }));
83 upm.put(
"@companyhhrr",
new RoleValue(
new String[] {
"is" }));
86 upm.put(
"@centerhhrr",
new RoleValue(
new String[] {
"is" }));
89 upm.put(
"@translator",
new RoleValue(
new String[] {
"is" }));
97 if(profiles !=
null) {
98 if(profiles.containsKey(profile)) {
105 for(String name : attributes.keySet()) {
111 if(!containsKey(name)) {
112 put(name,
new RoleValue(
new String[] {}));
static String logMsg(String msg)
static ProfileMap loadProfiles()
void loadAttribute(String name, RoleValue values)
void loadFromProfile(ProfileMap profiles, String profile)
static final String USERS_CONFIGURATION
void loadFrom(RoleAttribute attributes)
static UserProfileMap loadFromUser(Element user)
static UserProfileMap loadFromContact(IContact contact)