這段時間園子裡挺多個講這個東西,所以在完善架構的同時編寫的這樣一個組件;架構和該組件都是開源遵循Apache License 2.0 。話不多說了主要介紹一個這個組件,功能並沒有太複雜只是把使用者、角色、資源和授權幾個資料進行一整合處理。對於授權並沒有複雜的處理,畢竟實際應用總會有很多的差異,使用者可以根據自己的需要進行二次擴充。
資料結構圖:
組件和應用結構圖:
代碼結構簡介:
public IList<Owner> RoleListInUser(string userid)
{
IList<Owner> result = new List<Owner>();
Expression exp = Role.roleID.In(RoleLinkUser.roleID, RoleLinkUser.userID == userid);
foreach (Role item in exp.List<Role>())
{
result.Add(Owner.Parse(item));
}
return result;
}
package Api
{
import Core.Utility;
/**
* Action Script調用方法產生工具1.0 產生時間:2009-6-20 9:29:03
*/
public dynamic class PermissionServices_RoleListInUser
{
public var Callback:Function;
public var userid:Object;
public function Execute(method:String="get"):void
{
this._TimeSlice = new Date();
Utility.CallMethod("PermissionServices_RoleListInUser",this,Callback,method);
}
}
}
應用:
源碼下載和示範
http://www.nbao.net