微點存取控制程式庫函數
磁帶櫃套件會提供下列資源、群組與 ACL 功能,以及全域功能。
全域函數
函數 | 描述 |
---|---|
Initialization(identity *x509.Certificate, stub shim.ChaincodeStubInterface) (error) (error) |
部署鏈碼時,會呼叫 啟動安裝程序完成後,會建立下列實體:
|
NewGroupManager(identity *x509.Certificate, stub shim.ChaincodeStubInterface) (*GroupManager, error) |
取得用於所有群組相關作業的群組管理程式。 識別:相關作業的預設識別。如果為 nil,則函數會使用呼叫者的識別。 |
NewACLManager(identity *x509.Certificate, stub shim.ChaincodeStubInterface) (*ACLManager, error) |
取得用於所有 ACL 相關作業的 ACL 管理程式。 識別:相關作業的預設識別。如果為 nil,則函數會使用呼叫者的識別。 |
NewResourceManager(identity *x509.Certificate, stub shim.ChaincodeStubInterface) (*ResourceManager, error) |
取得用於所有資源相關作業的資源管理程式。 識別:相關作業的預設識別。如果為 nil,則函數會使用呼叫者的識別。 |
存取控制清單 (ACL) 功能
ACL
結構的定義:type ACL struct {
Name string
Description string
Accesses []string // CREATE, READ, UPDATE, and DELETE, or whatever the end-user defined
Patterns []string // identities
Allowed bool // true means allows access.
BindACLs []string // The list of ACL , control who can call the APIs of this struct
}
- 存取權: Accesses 字串是任意格式的存取名稱清單,除了 CREATE、READ、UPDATE 和 DELETE 之外,它完全由應用程式決定。這些存取值用於維護微點存取控制。應用程式可以使用自己的存取字串,例如
"register"
、"invoke"
或"query"
,甚至是存取欄位名稱 (例如"owner"
、"quantity"
等等)。 - 允許: 允許判斷符合樣式的身分識別是允許存取 (真) 還是禁止存取 (偽)。您可以擁有指示 Bob 可存取 "
CREATE
" 的存取控制清單,而另一個指示 Oracle 群組 (其中 Bob 是成員) 禁止從"CREATE"
存取。Bob 是否有存取權,取決於與有問題之實體相關聯的存取控制清單順序。 - BindACLs:BindACLs 參數構成初始存取控制清單。
ACL 功能:
函數 | 描述 |
---|---|
Create(acl ACL, identity *x509.Certificate) (error) |
建立 ACL。不允許重複的具名 ACL。 若要建立 ACL,該身份必須具有名為 " 的啟動安裝資源的 CREATE 存取權。ACL。如果識別為 nil,則會使用 |
Get(aclName string, identity *x509.Certificate) (ACL, error) |
取得指定的 ACL。 識別必須具有具名 ACL 的 READ 存取權。如果識別為 nil,則會使用 |
Delete(aclName string, identity *x509.Certificate) (error) |
刪除指定的 ACL。 識別必須具備對具名 ACL 的 DELETE 存取權。如果識別為 nil,則會使用 |
Update(acl ACL, identity *x509.Certificate) (error) |
更新 ACL。 識別必須具有指定資源的 UPDATE 存取權,且指定的 ACL 必須存在。如果識別為 nil,則會使用 |
AddPattern(aclName string, pattern string, identity *x509.Certificate) (error) |
新增識別樣式至指定的 ACL。識別必須具有具名 ACL 的 UPDATE 存取權。 如果識別為 nil,則會使用 |
RemovePattern(aclName string, pattern string, identity *X509Certificate) (error) |
移除 ACL 的識別樣式。識別必須具有具名 ACL 的 UPDATE 存取權。 如果識別為 nil,則會使用 |
AddAccess(aclname string, access string, identity *X509Certificate) (error) |
將新的存取權新增至指定的 ACL。識別必須具有具名 ACL 的 UPDATE 存取權。 如果識別為 nil,則會使用 |
RemoveAccess(aclName string, access string, identity *X509Certificate) (error) |
移除 ACL 的存取權。識別必須具有具名 ACL 的 UPDATE 存取權。 如果識別為 nil,則會使用 |
UpdateDescription(aclName string, newDescription string, identity *X509Certificate) (error) |
更新描述。 身分識別必須具有具名 ACL 的 UPDATE 存取權。如果識別為 nil,則會使用 |
AddBeforeACL(aclName string, beforeName string, newBindACL string, identity *X509Certificate) (error) |
在現有的具名 ACL 之前新增連結 ACL。如果指定的 ACL 是空的或找不到,就會將 ACL 新增至連結 ACL 清單的開頭。 身分識別必須具有具名 ACL 的 UPDATE 存取權。如果識別為 nil,則會使用 |
AddAfterACL(aclName string, afterName string, newBindACL string, identity *X509Certificate) (error) |
在現有的具名 ACL 之後新增連結 ACL。如果指定的 ACL 是空的或找不到,ACL 會新增至連結 ACL 清單的結尾。 身分識別必須具有具名 ACL 的 UPDATE 存取權。如果識別為 nil,則會使用 |
RemoveBindACL(aclName string, removeName string, identity *X509Certificate) (error) |
將 身分識別必須具有具名 ACL 的 UPDATE 存取權。如果識別為 nil,則會使用 |
GetAll(identity *x509.Certificate) ([]ACL, error) |
取得所有 ACL。 識別必須具有具名 ACL 的 READ 存取權。如果識別為 nil,則會使用 |
群組功能
Group
結構的定義:type Group struct {
Name string
Description string
Members []string // identity patterns, except GRP.
BindACLs []string // The list of ACLs, controls who can access this group.
}
GroupManager
函數的定義:
函數 | 描述 |
---|---|
Create(group Group, identity *x509.Certificate) (error) |
建立群組。 識別必須具備啟動安裝群組 |
Get(groupName string, identity *x509.Certificate) (Group, error) |
取得指定的群組。 識別必須具備此群組的讀取存取權。如果識別為 nil,則會使用 |
Delete(groupName string, identity *x509.Certificate) (error) |
刪除指定的群組。 識別必須具備此群組的 DELETE 存取權。如果識別為 nil,則會使用 |
AddMembers(groupName string, member []string, identity *x509.Certificate) (error) |
新增一或多個成員至群組。 身分識別必須具有此群組的 UPDATE 存取權。如果識別為 nil,則會使用 |
RemoveMembers(groupName string, member []string, identity *x509.Certificate) (error) |
從群組中移除一或多個成員。 身分識別必須具有此群組的 UPDATE 存取權。如果識別為 nil,則會使用 |
UpdateDescription(groupName string, newDes string, identity *x509.Certificate) (error) |
更新描述。 身分識別必須具有此群組的 UPDATE 存取權。如果識別為 nil,則會使用 |
AddBeforeACL(groupName string, beforeName string, aclName string, identity *x509.Certificate) (error) |
在現有的具名 ACL 之前,將連結 ACL 加到群組。如果指定的 ACL 是空的或找不到,ACL 會新增至該資源之連結 ACL 清單的開頭。 身分識別必須具有指定群組的 UPDATE 存取權。如果識別為 nil,則會使用 |
AddAfterACL(groupName string, afterName string, aclName string, identity *x509.Certificate) (error) |
將連結 ACL 加到現有具名 ACL 之後的群組。如果指定的 ACL 是空的或找不到的,ACL 會新增至該群組之連結 ACL 清單的結尾。 身分識別必須具有指定群組的 UPDATE 存取權。如果識別為 nil,則會使用 |
RemoveBindACL(groupName string, aclName string, identity *x509.Certificate) (error) |
從具名群組的連結 ACL 清單移除具名的 ACL。 身分識別必須具有指定群組的 UPDATE 存取權。如果識別為 nil,則會使用 |
GetAll(identity *x509.Certificate) ([]Group, error) |
取得所有群組。 識別必須具有這些群組的讀取存取權。如果識別為 nil,則會使用 |
資源函數
Resource
結構的定義:type Resource struct {
Name string
Description string
BindACLs []string // The name list of ACL, controls who can access this resource
}
資源函數:
拍賣 | 描述 |
---|---|
Create(resource Resource, identity *x509.Certificate) (error) |
建立資源。不允許重複的指定資源。 識別必須具備對 |
Get(resName string, identity *x509.Certificate) (Resource, error) |
取得指定的資源。 識別必須具備資源的讀取存取權。如果識別為空值,則會使用 |
Delete(resName string, identity *x509.Certificate) (error) |
刪除具名資源。 識別必須具備指定資源的 DELETE 存取權。如果識別為空值,則會使用 |
UpdateDescription(resourceName string, newDes string, identity *x509.Certificate) (error) |
更新描述。 識別必須具備此資源的 UPDATE 存取權。如果識別為 nil,則會使用 |
AddBeforeACL(resourceName string, beforeName string, aclName string, identity *x509.Certificate) (error) |
將連結 ACL 新增至現有具名 ACL 之前的資源。如果指定的 ACL 是空的或找不到,就會將 ACL 新增至資源的連結 ACL 清單開頭。 識別必須具有具名資源的 UPDATE 存取權。如果識別為 nil,則會使用 |
AddAfterACL(resourceName string, afterName string, aclName string, identity *x509.Certificate) (error) |
在現有的具名 ACL 之後新增連結 ACL 至資源。如果指定的 ACL 是空的或找不到,ACL 會新增至資源的連結 ACL 清單結尾。 識別必須具有具名資源的 UPDATE 存取權。如果識別為 nil,則會使用 |
RemoveBindACL(resourceName string, aclName string, identity *x509.Certificate) (error) |
從具名資源的連結 ACL 清單移除具名的 ACL。 識別必須具有具名資源的 UPDATE 存取權。如果識別為 nil,則會使用 |
CheckAccess(resName string, access string, identity *x509.Certificate) (bool, error) |
檢查目前的使用者是否具有指定資源的存取權。 如果識別為 nil,則會使用 |
GetAll(identity *x509.Certificate) ([]Resource, error) |
取得所有資源。 識別必須具備這些資源的讀取存取權。如果識別為 nil,則會使用 |