Status |
Proposal under development |
Target Release |
Roller Weblogger 4.1 |
Original Authors |
Dave Johnson |
1.0 Abstract
This is a proposal to make it possible to externalize user permissions so that Roller can pull user-weblog permissions from a separate user permissions system.
2.0 Background
Here's an explanation of Roller's current user permissions management, the perceived problems and proposed solutions.
2.1 Roller manages user-weblog permissions
In addition to roles, which are global across a Roller site, Roller also each user's permissions to access weblogs. There is a many-to-many relationship between users and weblogs and it's stored in a database table:
-- User permissions within a website -- permission_mask: bitmask 000 limited, 001 author, 011 admin -- pending: pending user acceptance of invitation to join website create table roller_user_permissions ( id varchar(48) not null primary key, website_id varchar(48) not null, user_id varchar(48) not null, permission_mask integer not null, pending $db.BOOLEAN_SQL_TYPE_TRUE not null );
There are three permission levels:
- limited: can edit draft weblog entries only, can submit for review
- author: can edit draft and publish weblog entries
- admin: can author and can manage users, weblog settings, theme and etc.
Each User object provides access to the User's weblog permissions. When a user logs in, we use this to display the user's list of weblogs.
User
public List getPermissions() public void setPermissions(List perms)
Each Weblog object provides access to the Weblog's permissions. When a weblog admin uses the manage members page, we use this information to display the list of weblog members and the permissions levels of each.
Weblog
public List getPermissions() public void setPermissions(List perms) public void removePermission(WeblogPermission perms) public int getUserCount() public int getAdminUserCount()
WeblogEntry
public boolean hasWritePermissions(User user)
2.1.1 Problem
Permissions cannot be managed by external system because the User to Permissions to Weblog relationship is managed by the ORM, the information must be stored in Roller database tables and cannot be externalized and managed by another system.
2.1.2 Solution: User Permissions API
Insead calling ORM supported methods on the Weblog and User classes, the Roller front-end will call the Roller UserManager to access permissions information. We'll add these new methods to accommodate that:
UserManager
public Set<WeblogPermission> getWeblogPermissions(Weblog weblog) public Set<WeblogPermission> getUserPermissions(User user) public void grantPermissions(WeblogPermission perm, String username) public void removePermissions(WeblogPermission perm) public int getUserCount(Weblog weblog) public int getAdminCount(Weblog weblog)
To allow us to plugin alternate user permissions systems Roller's default UserManager implementation will call a User Permissions API interface to store and retrieve permissions:
UserPermissions interface methods
public Set<Permissions> getObjectPermissions(String objectClass, String objectId) public Set<Permissions> getUserPermissions(String username) public void grantPermissions(Permissions perms, String username) public void removePermissions(Permissions
Permissions bean
int mask String objectClass String obectId
Roller will include a User Permissions API that stores data in the Roller database. Other implementations can be plugged in via DI.
You can stop reading here... the rest is TBD
3.0 Requirements
Requirements satisfied by this proposal
4.0 Issues
Issues to be considered
5.0 Design
List and describe new manager methods, Struts actions, JSP pages, macros, etc.
6.0 Comments
Other can leave commments here.