|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectARoad0.gBase.BasicImpl
ARoad0.gBase.EligiblePartyImpl
ARoad0.gBase.GroupIDMemberImpl
ARoad0.gBase.UserIDImpl
ARoad0.AcsAddon.Accbee.MySQL.gBase.UserIDMySQLImpl
public class UserIDMySQLImpl
This class is responsible for modeling a MySQL account to manage the constraints on the account membership, always with the type 'account'.
A host in MySQL is simulated by a GroupID having a 'host' type, with the special case of the group 'localhost' that has the type 'host byAcsCreator' to forbid its deleting by the Access Road user. The host to use, if it is not 'localhost', has to be an open ACS having an account with the new userID name as name (modulo '(N)' at the end), and the user 'anonymous' is the single exception to this rule. MySQL does not allow any wildcard in the user names.
The rights of 'tom@host_one' and 'tom@host_two' can be defined in two conditional ACLs but not as two accounts. In the database rights, MySQL handles the concept of user independantly of the concept of host, so it is necessary to modelize accounts as UserIDs. The account 'tom' may be set as member of only one host, and it may be necessary to define the account 'tom(2)' on another host.
There are two types of pattern-name groups, for hosts and for accounts-for-hosts, listed hereinafter:
(1) A pattern-name hosts group may be created by the Access Road user to contain all the hosts having a given pattern in their names.
(2) A pattern-name accounts-for-hosts group may be created by the Access Road user to contain all the accounts having a given pattern, like 'tom' and 'tom(2)'. The pattern-name accounts-for-hosts group name has then the form 'name§@YYYY', where YYYY contain a wildcard character.
The convention for these two types of pattern-name groups is to use in their names one '%' or '_' wildcard character. This class ensures that the accounts or groups are members of the two types of pattern-name groups that match to them. To deliver some rights to a given source 'tom' whatever its current host, a pattern-name accounts-for-hosts group 'tom§@%' is required. This form is proper to Access Road, since MySQL would rather uses 'tom@%'.
For a new account 'xxxx', an empty non-conditional ACL on 'MySQL Server' for the accounts-for-hosts group 'xxxx§@%' is set without rights, if it does not exist. This class implements the following rules, and informs the Access Road user with the same sentence as error message when they are not fulfilled with:
- The host of an account cannot be null.
- The name of an account cannot contain the characters '%', '_', '§' or '@'. - In an ACL, the condition group is the account host.
- User names can be up to 16 characters long, but no more.
- The host of an account has to be a simple host.
- The condition group must have a simple host type, that is not be a pattern-name group.
- The host name is not the name of an open ACS.
- The name xxx is not the name of an account in the open ACS.
For the account groups, the sorting is 'host', 'pattern-name_accounts-for-hosts group', then the sorting among the accounts-for-hosts groups from their names.
This class has no subclass in this package. ProxyMySQLImpl handles the proxy users, and it is derived from this class. It is a javabean with the following bound properties: 'CurrentGroupID'. The listeners are proper to this instance, outside gBase, transient (not serialized in this instance backup). They are called in any order. They receive the new value, without copy. All the exceptions from the listeners are catched, and a dialog box is displayed to inform the user.
Field Summary | |
---|---|
static UserIDMySQLImpl |
EMPTY_INSTANCE
A reusable empty instance for initialization, to avoid the use of 'new' for temporary values. |
protected GroupIDMySQLImpl |
host_
|
static java.io.ObjectStreamField[] |
serialPersistentFields
variable for the JDK 2 serialization |
private static long |
serialVersionUID__
|
Fields inherited from class ARoad0.gBase.UserIDImpl |
---|
l_currentActors_, l_ownResources_, order_, primGroup_ |
Fields inherited from class ARoad0.gBase.GroupIDMemberImpl |
---|
isAdmin_, l_Groups_ |
Fields inherited from class ARoad0.gBase.EligiblePartyImpl |
---|
m_AclEntriesResources_ |
Fields inherited from class ARoad0.gBase.BasicImpl |
---|
aCS_, aCS_Name_, aliasHandler_, changeSupport_, comment_, folderMember_, INCREMENT_CAPACITY, INITIAL_CAPACITY, INITIAL_CAPACITY_2, iS_Name_, m_ConstrainedChildACS_, name_, PRIME, privHandler_, type_ |
Constructor Summary | |
---|---|
UserIDMySQLImpl()
The basic constructor |
|
UserIDMySQLImpl(ImmutableName _name,
ACS _acs,
java.lang.String _epType,
java.lang.Boolean _isAdmin,
GroupIDMySQLImpl _host)
Constructor used in the beamer, from the 'New' button, to create an account. |
|
UserIDMySQLImpl(ImmutableName _name,
ACS _acs,
java.lang.String _epType,
boolean _isAdmin,
GroupIDMySQLImpl _host,
boolean _toRegisterInManager)
Currently unused. |
Method Summary | |
---|---|
protected void |
addEorSoftAlias(ImmutableName _proxy)
Adds a proxy account as source of a PROXY right on this instance. |
void |
addGroupToGM(GroupID _grp)
Adds a group for which this GroupIDMember is a member, and sorts the groups in an sortered array that follows the sorting order for the MySQL AclEntries, from the more-specific source to the least-specific ones. |
void |
addPropertyChangeListener(java.lang.String _propertyName,
java.beans.PropertyChangeListener _l)
Adds a listener to the bean. |
java.lang.Object |
copy(ImmutableName _name,
ACS _acs,
Directory _parent,
java.lang.Boolean _toRegisterInManager)
This method provides a copy of the instance with another name. |
protected UserIDMySQLImpl |
copyOwnVariables(UserIDMySQLImpl _result,
boolean _withoutInternalAcl)
This method provides a copy of the instance variables. |
java.lang.Object |
copyWithoutInternalAcl(ImmutableName _name,
ACS _acs,
Directory _parent,
java.lang.Boolean _toRegisterInManager)
This method provides a copy of the instance as copy() but without copying the internal AclEntries. |
void |
finalizeForBase()
This method removes this instance in its groups directly. |
java.util.Map<java.lang.String,java.lang.String> |
getAddonInnerPropertiesToListen()
Gets the specific events to listen from an ACSObject, because these events should change the rights of an ACSObject in an ACS Addon.Returns always null, because these events are listened only to update the views containing these ACSObjects. |
GroupIDMySQLImpl |
getEorFirstHost()
|
long |
getSerialVersionUID()
For the java serialization. |
protected void |
removeEorSoftAlias(ImmutableName _alias)
Removes a proxy account as source of a PROXY right on this instance. |
void |
removePropertyChangeListener(java.lang.String _propertyName,
java.beans.PropertyChangeListener _l)
Removes a listener to the bean. |
protected static void |
setValueOf(UserIDMySQLImpl _user,
GroupIDMySQLImpl _host)
Sets, for the constructors, a new account as member of the matched pattern-name groups and member of its mandatory host. |
Methods inherited from class ARoad0.gBase.UserIDImpl |
---|
addCurrentActor, addOwnResource, clone, copyOwnVariables, equals, finalize, finalizeFromDeserialization, getEorL_UserIDCurrentActors, getEorL_UserIDOwnResources, getEorPrimGroup, getOrder, getPropertyChangeListeners, hashCode, ownsResource, removeCurrentActor, removeGroupToGM, removeOwnResource, removePrimGroup, setEorPrimGroup, setOrder, toString |
Methods inherited from class ARoad0.gBase.GroupIDMemberImpl |
---|
copy, copyOwnVariables, copyWithoutAcl, getEorL_GroupID, isAdmin |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface ARoad0.gBaseInterface.UserID |
---|
finalizeForUser, setEorPrimGroup, setOrder |
Methods inherited from interface ARoad0.gBaseInterface.ImmutableUserID |
---|
getEorL_UserIDCurrentActors, getEorL_UserIDOwnResources, getEorPrimGroup, getOrder, ownsResource |
Methods inherited from interface ARoad0.gBaseInterface.GroupIDMember |
---|
removeGroupToGM |
Methods inherited from interface ARoad0.gBaseInterface.EligibleParty |
---|
setEPType |
Methods inherited from interface ARoad0.gBaseInterface.Basic |
---|
setComment |
Methods inherited from interface ARoad0.gBaseInterface.PrivilegeSource |
---|
addEorPrivilegeForTypeToSource, removeEorPrivilegeToSource |
Methods inherited from interface ARoad0.gBaseInterface.ImmutableGroupIDMember |
---|
getEorL_GroupID, isAdmin |
Methods inherited from interface ARoad0.gBaseInterface.ImmutableEligibleParty |
---|
getEorL_AclConnectedResources, getEPType, getM_ConstrainedChildACS |
Methods inherited from interface ARoad0.gBaseInterface.ImmutableBasic |
---|
getComment, getEorAliasAsInternalHardReference, getEorReferenceAsInternalHardAlias, getHasSoftAlias, getImpliedViews, getIS_Name, getL_AcsOfSoftReferences, getL_SoftAlias, getPropertyChangeListeners, getVirtualFolders |
Methods inherited from interface ARoad0.gBaseInterface.BoundBean |
---|
addPropertyChangeListener, removePropertyChangeListener |
Methods inherited from interface ARoad0.gBaseInterface.ImmutablePrivilegeSource |
---|
getEorL_SourcePrivilegeForLinks, getEorL_SourcePrivilegeForTypes, getEorL_SourcePrivileges |
Methods inherited from interface ARoad0.gBaseInterface.ImmutableSource |
---|
getEorAliasAsInternalHardReference, getEorReferenceAsInternalHardAlias, getHasSoftAlias, getL_AcsOfSoftReferences, getL_SoftAlias, getType |
Methods inherited from interface ARoad0.gBaseInterface.ACSObject |
---|
getAcsName, getEorACS |
Methods inherited from interface ARoad0.gBaseInterface.BaseObject |
---|
equals, getFullName, getName, getNickName, hashCode |
Methods inherited from interface ARoad0.gBaseInterface.BaseBeanManager |
---|
addPropertyChangeListener, removePropertyChangeListener |
Methods inherited from interface ARoad0.gBaseInterface.ImmutableTarget |
---|
getEorAliasAsInternalHardReference, getEorReferenceAsInternalHardAlias, getHasSoftAlias, getL_AcsOfSoftReferences, getL_SoftAlias, getType |
Field Detail |
---|
private static final long serialVersionUID__
protected GroupIDMySQLImpl host_
public static final UserIDMySQLImpl EMPTY_INSTANCE
public static final java.io.ObjectStreamField[] serialPersistentFields
Constructor Detail |
---|
public UserIDMySQLImpl()
public UserIDMySQLImpl(ImmutableName _name, ACS _acs, java.lang.String _epType, java.lang.Boolean _isAdmin, GroupIDMySQLImpl _host) throws CreateError
A host in MySQL is simulated by a GroupID having a 'host' type, with the special case of the group 'localhost' that has the type 'host byAcsCreator' to forbid its deleting by the Access Road user. The host to use, if it is not 'localhost', has to be an open ACS having an account with the new userID name as name, and the user 'anonymous' is the single exception to this rule.
This constructor ensures that the new account is member of the pattern-name accounts-for-hosts groups that match to it, if it is not the user 'anonymous'. For a new account 'user', an empty non-conditional ACL on 'MySQL Server' is set without rights for the accounts-for-hosts group 'user§@%', if it does not exist. Calls setValueOf(). Calls the super constructor.
_name
- ImmutableName of the userID as a kind of eligible party_acs
- ACS owning the userID_epType
- is the eligible party type, and may be null if the ACS allows it._isAdmin
- true only if the instance has an administrative role in the ACS,
for the technical administration or the users_host
- mandatory host for an account. Never null.
CreateError
- if ACS.newEorEligibleParty() throws it - the instance
must then be deleted !public UserIDMySQLImpl(ImmutableName _name, ACS _acs, java.lang.String _epType, boolean _isAdmin, GroupIDMySQLImpl _host, boolean _toRegisterInManager) throws CreateError
_name
- ImmutableName of the eligible party to create_acs
- Main ACS of the eligible party to create_epType
- is the eligible party type, and may be null if the ACS allows it._isAdmin
- true only if the instance has an administrative role in the ACS,
for the technical administration or the users_host
- mandatory host for an account. Never null._toRegisterInManager
- false if this method must not register
the instance in its ACS.
CreateError
- if ACS.newEorEligibleParty() throws it -
the instance must then be deleted !Method Detail |
---|
public long getSerialVersionUID()
BasicImpl
getSerialVersionUID
in interface ImmutableBasic
getSerialVersionUID
in class UserIDImpl
public java.util.Map<java.lang.String,java.lang.String> getAddonInnerPropertiesToListen()
- 'THIS' to say that the single object to listen is the ACSObject,
- 'ACS.method_name' to say that the list of objects to listen is returned by the method 'method_name' in the Addon ACS class.
For each map key, the values have the following format:
'AAA.method_name IF BBB'
where:
- AAA: THIS (mandatory),
- method_name: 'get' method name of the ACSObject that is associated, in the relevant BeanInfo class, to the event to listen (mandatory)
- IF BBB: where BBB is TRUE, or FALSE, or NULL, or NOT-NULL, to say that the event must be listened if and only if the returned value of the method_name is respectively a boolean TRUE, or FALSE, or an object NULL, or NOT-NULL (option).
When the map value starts with 'ACS', the ACS method to call has the ACSObject has one argument. Otherwise, the ACS or the ACSObject method has no argument. Called by ARoad0.UtilityImpl.removeAddonParentPropertyChangeListener().
getAddonInnerPropertiesToListen
in interface ACSObjectAddon
AcsAddon.getAddonParentPropertiesToListen()
public void addGroupToGM(GroupID _grp)
addGroupToGM
in interface GroupIDMember
addGroupToGM
in class UserIDImpl
_grp
- is the groupID to add. No action if it is null, or with null name.public void finalizeForBase() throws UpDateError
finalizeForBase
in interface FinalizedObject
finalizeForBase
in class UserIDImpl
UpDateError
- if the instance cannot be removed from its first host grouppublic void addPropertyChangeListener(java.lang.String _propertyName, java.beans.PropertyChangeListener _l)
addPropertyChangeListener
in interface BaseBeanManager
addPropertyChangeListener
in interface BoundBean
addPropertyChangeListener
in class UserIDImpl
_propertyName
- name of the property_l
- PropertyChangeListener to add. Caution: the listener must NOT
have specific hashCode() and equals() methods, to work with HashSet
in the removing operations.public void removePropertyChangeListener(java.lang.String _propertyName, java.beans.PropertyChangeListener _l)
removePropertyChangeListener
in interface BaseBeanManager
removePropertyChangeListener
in interface BoundBean
removePropertyChangeListener
in class UserIDImpl
_propertyName
- name of the property_l
- PropertyChangeListener to removepublic GroupIDMySQLImpl getEorFirstHost()
getEorFirstHost
in interface UserIDMySQL
public java.lang.Object copy(ImmutableName _name, ACS _acs, Directory _parent, java.lang.Boolean _toRegisterInManager) throws CreateError
copy
in interface Copyable
copy
in class UserIDImpl
_name
- copy name. Usually creates as an extension of _parent name._acs
- main ACS of the copy to create. May not be the ACS of this instance._parent
- is not used, wathever the value._toRegisterInManager
- false if this method must not register
the instance in the ACS.
CreateError
- of the constructor with the same parameters,
or if _parent ACS is not _acs, or addAclEntry() exceptions.public java.lang.Object copyWithoutInternalAcl(ImmutableName _name, ACS _acs, Directory _parent, java.lang.Boolean _toRegisterInManager) throws CreateError
copyWithoutInternalAcl
in interface EligibleParty
copyWithoutInternalAcl
in class UserIDImpl
_name
- copy name. Usually creates as an extension of _parent name._acs
- main ACS of the copy to create. May not be the ACS of this instance._parent
- is not used, wathever the value._toRegisterInManager
- false if this method must not register
the instance in the ACS.
CreateError
- of the constructor with the same parameters,
or if _parent ACS is not _acs, or addAclEntry() exceptions.protected UserIDMySQLImpl copyOwnVariables(UserIDMySQLImpl _result, boolean _withoutInternalAcl) throws CreateError
_result
- to update with this instance variables copies_withoutInternalAcl
- true if the internal AclEntries
- that is with a resource having the same ACS - must not be copied
CreateError
protected static void setValueOf(UserIDMySQLImpl _user, GroupIDMySQLImpl _host) throws CreateError
This constructor ensures that the new account is member of the pattern-name accounts-for-hosts groups that match to it, if it is not the user 'anonymous'. For a new account 'user', an empty non-conditional ACL on 'MySQL Server' is set without rights for the accounts-for-hosts group 'user§@%', if it does not exist. Called by the constructors. Calls GroupIDMySQLImpl.isMemberOfMySQLPatternNameGroup() and addEorMemberToPatternNameGroup().
_user
- new instance of this class_host
- host group is mandatory. Never null.
CreateError
- if the constraints are not fulfilled withprotected void addEorSoftAlias(ImmutableName _proxy) throws UpDateError
Fires the events 'SoftAlias' and 'hasSoftAlias'.
addEorSoftAlias
in class BasicImpl
_proxy
- No action if null, or already known.
UpDateError
- the type is immutableprotected void removeEorSoftAlias(ImmutableName _alias) throws UpDateError
Fires the 'SoftAlias' and the 'hasSoftAlias' property change events. If firePropertyChange() throws an exception, displays an user message. No action if the list is null.
removeEorSoftAlias
in class BasicImpl
_alias
- is a registered alias. No action if null.
UpDateError
- if _proxy is not known.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |