Example #1
0
func Check(tx *sql.Tx, userUID string, object string, permission string, action string) (bool, error) {
	grs, err := groupS.GetByUserUID(tx, userUID, 100, 0)
	if err != nil {
		return false, err
	}

	allowed, err := CheckGroups(tx, grs, object, permission, action)

	return allowed, err
}
Example #2
0
func CheckGroup(tx *sql.Tx, userUID string, group string) (bool, error) {
	grs, err := groupS.GetByUserUID(tx, userUID, 100, 0)
	if err != nil {
		return false, err
	}

	for _, gr := range grs {
		if group == gr.Name {
			return true, nil
		}
	}
	return false, nil
}