Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
94fc4331
Y
YTBP
项目概览
YottaChain
/
YTBP
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
YTBP
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
94fc4331
编写于
8月 02, 2017
作者:
N
Nathan Hourt
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Ref #123: Define types
Define the types documented in the issue. TODO: Implement logic
上级
ec03f1f0
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
90 addition
and
0 deletion
+90
-0
libraries/chain/include/eos/chain/permission_link_object.hpp
libraries/chain/include/eos/chain/permission_link_object.hpp
+81
-0
libraries/chain/include/eos/chain/types.hpp
libraries/chain/include/eos/chain/types.hpp
+3
-0
libraries/types/types.eos
libraries/types/types.eos
+6
-0
未找到文件。
libraries/chain/include/eos/chain/permission_link_object.hpp
0 → 100644
浏览文件 @
94fc4331
/*
* Copyright (c) 2017, Respective Authors.
*
* The MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#pragma once
#include <eos/chain/authority.hpp>
#include "multi_index_includes.hpp"
namespace
eos
{
namespace
chain
{
/**
* @brief The permission_link_object class assigns permission_objects to message types
*
* This class records the links from contracts and message types within those contracts to permission_objects
* defined by the user to record the authority required to execute those messages within those contracts. For
* example, suppose we have a contract called "currency" and that contract defines a message called "transfer".
* Furthermore, suppose a user, "joe", has a permission level called "money" and joe would like to require that
* permission level in order for his account to invoke currency.transfer. To do this, joe would create a
* permission_link_object for his account with "currency" as the code account, "transfer" as the message_type, and
* "money" as the required_permission. After this, in order to validate, any message to "currency" of type
* "transfer" that requires joe's approval would require signatures sufficient to satisfy joe's "money" authority.
*/
class
permission_link_object
:
public
chainbase
::
object
<
permission_link_object_type
,
permission_link_object
>
{
OBJECT_CTOR
(
permission_link_object
)
id_type
id
;
AccountName
account
;
AccountName
code
;
FuncName
message_type
;
PermissionName
required_permission
;
};
struct
by_message_type
;
struct
by_permission_name
;
using
permission_link_index
=
chainbase
::
shared_multi_index_container
<
permission_link_object
,
indexed_by
<
ordered_unique
<
tag
<
by_id
>
,
BOOST_MULTI_INDEX_MEMBER
(
permission_link_object
,
permission_link_object
::
id_type
,
id
)
>
,
ordered_unique
<
tag
<
by_message_type
>
,
composite_key
<
permission_link_object
,
BOOST_MULTI_INDEX_MEMBER
(
permission_link_object
,
AccountName
,
account
),
BOOST_MULTI_INDEX_MEMBER
(
permission_link_object
,
AccountName
,
code
),
BOOST_MULTI_INDEX_MEMBER
(
permission_link_object
,
FuncName
,
message_type
)
>
>
,
ordered_unique
<
tag
<
by_permission_name
>
,
composite_key
<
permission_link_object
,
BOOST_MULTI_INDEX_MEMBER
(
permission_link_object
,
AccountName
,
account
),
BOOST_MULTI_INDEX_MEMBER
(
permission_link_object
,
PermissionName
,
required_permission
),
BOOST_MULTI_INDEX_MEMBER
(
permission_link_object
,
AccountName
,
code
),
BOOST_MULTI_INDEX_MEMBER
(
permission_link_object
,
FuncName
,
message_type
)
>
>
>
>
;
}
}
// eos::chain
CHAINBASE_SET_INDEX_TYPE
(
eos
::
chain
::
permission_link_object
,
eos
::
chain
::
permission_link_index
)
FC_REFLECT
(
eos
::
chain
::
permission_link_object
,
(
id
)(
account
)(
code
)(
message_type
)(
required_permission
))
libraries/chain/include/eos/chain/types.hpp
浏览文件 @
94fc4331
...
...
@@ -118,6 +118,7 @@ namespace eos { namespace chain {
using
eos
::
types
::
Transaction
;
using
eos
::
types
::
PermissionName
;
using
eos
::
types
::
TypeName
;
using
eos
::
types
::
FuncName
;
using
eos
::
types
::
Time
;
using
eos
::
types
::
Field
;
using
eos
::
types
::
String
;
...
...
@@ -161,6 +162,7 @@ namespace eos { namespace chain {
null_object_type
,
account_object_type
,
permission_object_type
,
permission_link_object_type
,
action_code_object_type
,
key_value_object_type
,
key128x128_value_object_type
,
...
...
@@ -206,6 +208,7 @@ FC_REFLECT_ENUM(eos::chain::object_type,
(
null_object_type
)
(
account_object_type
)
(
permission_object_type
)
(
permission_link_object_type
)
(
action_code_object_type
)
(
key_value_object_type
)
(
key128x128_value_object_type
)
...
...
libraries/types/types.eos
浏览文件 @
94fc4331
...
...
@@ -125,3 +125,9 @@ struct UpdatePermission
struct DeletePermission
account AccountName
permission PermissionName
struct requirepermission
account AccountName
code AccountName
type FuncName
requirement PermissionName
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录